using System;
using System.Collections.Generic;
using System.Text;

namespace GoogleNet
{
    /// <summary>
    /// A Placemark is a Feature with associated Geometry. In Google Earth, a Placemark 
    /// appears as a list item in the Places panel. A Placemark with a Point has an icon associated 
    /// with it that marks a point on the earth in the 3D viewer. (In the Google Earth 3D viewer, a 
    /// Point Placemark is the only object you can click or roll over. Other Geometry objects do not 
    /// have an icon in the 3D viewer. To give the user something to click, you would need to add a 
    /// Point to the Polygon.)
    /// </summary>
    public class KmlPlacemark : KmlFeature, IKmlFeature
    {
        private string tagName = "Placemark";

        #region IKmlElement Members

        /// <summary>
        /// Name of the KML tag for this specific element.
        /// </summary>
        /// <value></value>
        /// <returns></returns>
        string IKmlElement.TagName
        {
            get { return tagName; }
        }

        #endregion

        #region Geometry
        private IKmlGeometry geometry;

        /// <summary>
        /// Gets or sets the geometry.
        /// </summary>
        /// <value>The geometry.</value>
        public IKmlGeometry Geometry
        {
            get { return geometry; }
            set { geometry = value; }
        } 
        #endregion

        #region IKmlGenerator Members

        /// <summary>
        /// Generates the KML for this element including its child elements.
        /// </summary>
        /// <param name="writer">The XML writer that will be used to generate the KML.</param>
        void IKmlGenerator.GenerateKml(System.Xml.XmlTextWriter writer)
        {
            writer.WriteStartElement(tagName);
            base.GenerateKml(writer);
            geometry.GenerateKml(writer);
            writer.WriteFullEndElement();
        }

        #endregion
    }
}
